﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EasyCore.DataValidation
{
    public class DataValidationMvcConfiguration
    {
        /// <summary>
        /// 是否禁用内置.net的校验
        /// </summary>
        public bool DisableBuiltInModelValidation { get; set; } = false;

        /// <summary>
        /// 启用Body绑定源验证
        /// </summary>
        public bool EnableBodyBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 启用表单绑定源验证
        /// </summary>
        public bool EnableFormBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 启用查询绑定源验证
        /// </summary>
        public bool EnableQueryBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 启用路径绑定源验证
        /// </summary>
        public bool EnablePathBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 启用自定义绑定源验证
        /// </summary>
        public bool EnableCustomBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 启用非空绑定源验证
        /// </summary>
        public bool EnableNullBindingSourceValidation { get; set; } = true;

        /// <summary>
        /// 验证结果工厂
        /// </summary>
        public Type? ValidationResultFactory { get; private set; }

        /// <summary>
        /// 重写结果工厂
        /// </summary>
        /// <typeparam name="TResultFactory"></typeparam>
        public void OverrideResultFactoryWith<TResultFactory>() where TResultFactory : IEasyValidationResultFactory{
            ValidationResultFactory = typeof(TResultFactory);
        }
    }
}
